package com.dao.lx;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import com.entity.Dept;
import com.entity.User;

public interface UserDAO extends JpaRepository<User, Long>{
	@Query("from User u where u.userIfdelete = 1")
	public Page<User> findAllUserIfdelete(Pageable p);
	
	@Query("from User u where u.userIfdelete = 1 and u.userUid like %?1%")
	public Page<User> findByUserUid(String userUid, Pageable p);
	
	@Query("from User u where u.userIfdelete = 1 and u.dept like ?1")
	public Page<User> findByUserDept(Dept dept, Pageable p);

	@Query("from User u where u.userUid = ?1 and u.userPwd = ?2 and u.userIfdelete = 1")
	public User login(String userUid, String password);

	@Query("from User u where u.userUid = ?1 and u.userIfdelete = 1")
	public User findByUserUid(String userUid);
}